package com.group.app.example.repository;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

//@Repository
public class ExampleRepository {

    @Autowired
    @Qualifier("pgJdbcTemplate")
    private JdbcTemplate pgjdbcTemplate;

//    @Autowired
//    @Qualifier("mysqlJdbcTemplate")
//    private JdbcTemplate mysqlJdbcTemplate;

    public List<Map<String,Object>> getdata(){
        String sql="select * from score_demo where score > :score";
        Map<String,Object> param=new HashMap<>();
        param.put("score",60);
        NamedParameterJdbcTemplate namedParameterJdbcTemplate=new NamedParameterJdbcTemplate(pgjdbcTemplate);
        return  namedParameterJdbcTemplate.queryForList(sql,param);
    }

//    public List<Map<String,Object>> getmysqldata(){
//        String sql="select * from tb_pay_info";
//        return  mysqlJdbcTemplate.queryForList(sql);
//    }




}
